<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var num = 12;
        var str = 'aa';
        var bool = true;
        var nu1 = null;
        var def = undefined;
        var arr = [];
        var obj = {};
        var fun = function() {};
        // typeof 返回一个字符串
        /**
         * 可以检测基本数据类型（除null）和 function
          */
        console.log(typeof num); //   'number'
        console.log(typeof str); //   'string'
        console.log(typeof bool);//   'boolean'
        console.log(typeof nu1); //   'object'--------
        console.log(typeof def); //   'undefined'
        console.log(typeof arr); //   'object'
        console.log(typeof obj); //   'object'
        console.log(typeof fun); //   'function'
    </script>
</body>
</html>